<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增商品上架管理')"/>
    <th:block th:include="include :: ztree-css"/>
    <th:block th:include="include :: select2-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-push-add">
        <div class="row col-sm-12">
            <div class="row col-sm-6">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">产品名称：</label>
                    <div class="col-sm-9">
                        <select name="productId" class="form-control">
                            <option th:each="item:${productInfoList}" th:text="${item.name}"
                                    th:value="${item.value}"></option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">不推送的量：</label>
                    <div class="col-sm-9">
                        <label class="check-box" th:each="item:${noShowTypeList}">
                            <input type="checkbox" name="notExcludeBrowser" th:value="${item.value}"
                                   th:text="${item.name}"></label>
                        </label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">场景：</label>
                    <div class="col-sm-9">
                        <!--                    <select name="sceneIds" style="width: 100px">-->
                        <!--                        <option  th:each="item:${scencInfoList}" th:text="${item.name}" th:value="${item.value}"></option>-->
                        <!--                    </select>-->

                        <label class="check-box" th:each="item:${scencInfoList}">
                            <input type="checkbox" name="sceneIds" th:value="${item.value}"
                                   th:text="${item.label}"></label>
                        </label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">客户端：</label>
                    <div class="col-sm-9">
                        <!--                    <select name="clientTypes" style="width: 100px">-->
                        <!--                        <option  th:each="item:${clietTypeList}" th:text="${item.name}" th:value="${item.value}"></option>-->
                        <!--                    </select>-->

                        <label class="check-box" th:each="item:${clietTypeList}">
                            <input type="checkbox" name="clientTypes" th:value="${item.value}"
                                   th:text="${item.label}"></label>
                        </label>
                    </div>
                </div>
<!--                <div class="form-group">-->
<!--                    <label class="col-sm-3 control-label is-required">芝麻分数：</label>-->
<!--                    <div class="col-sm-9">-->
<!--                        <label class="check-box" th:each="item:${zhiMaTypeList}">-->
<!--                            <input type="checkbox" name="zhimaFilter" th:value="${item.value}"-->
<!--                                   th:text="${item.name}"></label>-->
<!--                        </label>-->
<!--                    </div>-->
<!--                </div>-->

                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">上架渠道类型：</label>
                    <div class="col-sm-9">
                        <label class="check-box" th:each="item:${channelTypeList}">
                            <input type="checkbox" name="channelTypes" th:value="${item.value}"
                                   th:text="${item.name}"></label>
                        </label>
                    </div>
                </div>

                <!--            <div class="form-group">-->
                <!--                <label class="col-sm-3 control-label">不显示城市：</label>-->
                <!--                <div class="col-sm-8">-->
                <!--                    <textarea name="notShowCitys" class="form-control"></textarea>-->
                <!--                </div>-->
                <!--            </div>-->
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">排序权重：</label>
                    <div class="col-sm-9">
                        <input name="sortWeight" class="form-control" type="text" th:value="1">
                        <span style="color: red">值越大排的越靠前</span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">uv控量：</label>
                    <div class="col-sm-9">
                        <input name="productName" class="form-control" type="text" th:value="9999">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">开始时间：</label>
                    <div class="col-sm-9">
                        <input name="showStartTime" id="showStartTime" class="form-control" value="00:00:00" type="text"
                               required>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">结束时间：</label>
                    <div class="col-sm-9">
                        <input name="showEndTime" id="showEndTime" class="form-control" value="23:59:59" type="text"
                               required>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">开始日期：</label>
                    <div class="col-sm-9">
                        <input name="showStartDate" id="showStartDate" class="form-control" value="2000-01-01"
                               type="text"
                               required>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">结束日期：</label>
                    <div class="col-sm-9">
                        <input name="showEndDate" id="showEndDate" class="form-control" value="2100-01-01" type="text"
                               required>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label"></label>
                    <div class="col-sm-9">
                        <button type="button" onclick="submitHandler()" class="btn-primary btn">提交</button>
                    </div>
                </div>
            </div>

            <div class="row col-sm-6">
                <input type="hidden" name="notShowCitys" id="notShowCitys"/>
                <div class="form-group">
                    <label class="col-sm-3 control-label">不显示城市：</label>
                    <div class="col-sm-9">
                        <div id="addressTrees" class="ztree ztree-border"></div>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: ztree-js"/>
<script th:inline="javascript">
    var prefix = ctx + "product/push"
    $("#form-push-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        $("#notShowCitys").val($.tree.getCheckedNodesByElemId("addressTrees"))
        if ($.validate.form()) {
            $.operate.saveTab(prefix + "/add", $('#form-push-add').serialize());
        }
    }

    $(function () {

        layui.use('laydate', function () {
            var laydate = layui.laydate;

            laydate.render({
                elem: '#showStartTime',
                type: 'time'
            });

            laydate.render({
                elem: '#showEndTime',
                type: 'time'
            });

            laydate.render({
                elem: '#showStartDate',
                type: 'date'
            });

            laydate.render({
                elem: '#showEndDate',
                type: 'date'
            });
        });
    });

    /***
     * 地址树信息
     */
    $(function () {
        var url = ctx + "system/address/treeData";
        var options = {
            id: "addressTrees",
            url: url,
            check: {enable: true, chkboxType: {"Y": "", "N": ""}},
            expandLevel: 0
        };
        $.tree.init(options);
    });
</script>
</body>
</html>